#include<iostream>
using namespace std;

//剑指offer题20：定义一个栈，使它实现一个min函数，min函数能再O(1)取出栈中最小的数据
#include<stack>
class Stack
{
public:
	void Push(int x)
	{
		s.push(x);
		if (help.empty())
			help.push(x);
		else
		{
			if (x < help.top())
				help.push(x);
			else
				help.push(help.top());
		}
	}

	void pop()
	{
		s.pop();
		help.pop();
	}

	int Min()
	{
		return help.top();
	}

private:
	stack<int> s;
	stack<int> help;
};
